package com.wzh.ret2.interfaces;


import com.alibaba.fastjson.JSONObject;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;


/**
 * @Author Hu
 * @Time 2017/3/23 .14:46.
 * @Email 87683202@qq.com
 */
public interface RequestServes {

    @GET("clientOrder_getRestaurants.action?")
    Call<String> getAllRests(@Query("curpage") int currage, @Query("pageno") int pageno, @Query("city") String city,
                             @Query("lat") double lat, @Query("lot") double lot);

    @GET("clientOrder_getRestaurants.action?")
    Call<String> getAllRestsOnlyCity(@Query("curpage") int currage, @Query("pageno") int pageno, @Query("city") String city);


    @GET(value = "getResses.do?")
    Observable<JSONObject> getResses();

    @GET(value = "add_res.do?")
    Call<JSONObject> add_res(@Query(value = "res_name") String res_name, @Query(value = "res_address") String address,
                             @Query(value = "group_id") Integer group_id,
                             @Query(value = "res_phone") String phone);

    @GET(value = "updateRes.do?")
    Call<JSONObject> updateRes(@Query(value = "id") Integer id, @Query(value = "res_name") String res_name, @Query(value = "res_address") String address,
                               @Query(value = "group_id") Integer group_id,
                               @Query(value = "res_phone") String phone);

    @GET(value = "delRes.do?")
    Call<JSONObject> delRes(@Query(value = "id") Integer id);

    //    @Multipart
//    @POST("upload.do?")
//    Call<ResponseBody> upload(@Part("description") RequestBody description,
//                              @Part MultipartBody.Part file);
    //单文件上传
    @Multipart
    @POST("upload.do?")
    Call<JSONObject> upload(@Part MultipartBody.Part file);

    //单文件与数据一起上传
    @Multipart
    @POST("uploadWithValue.do?")
    Call<JSONObject> uploadWithValue(@Query(value = "id") Integer id, @Part MultipartBody.Part file);

    @Multipart
    @POST("uploadList.do?")
    Call<JSONObject> uploadList(@Query(value = "res_name") String name, @Part List<MultipartBody.Part> parts);

}
